package com.ljq.collectionD;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;

/**
 * Description: List集合 LinkedList
 * Author: A
 * Date: 2025/2/26
 * Time: 15:25
 */
public class CollectionDemo1 {
    public static void main(String[] args) {
        ArrayList<Object> list = new ArrayList<>();

        list.add("1");
        list.add("2");
        list.add("3");

        System.out.println(list.contains("1"));
        list.set(2,"4");
        list.remove(2);
        System.out.println(list.get(1));
        System.out.println(list);


        //把集合转换为数组
        Object[] objects = list.toArray();
        System.out.println(Arrays.toString(objects));
    }
}
